home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / idparam.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.5 KB  |  113 lines

  1. /* Copyright (C) 1992, 2000 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: idparam.h,v 1.3 2000/09/19 19:00:43 lpd Exp $ */
  20. /* Interface to idparam.c */
  21.  
  22. #ifndef idparam_INCLUDED
  23. #  define idparam_INCLUDED
  24.  
  25. #ifndef gs_matrix_DEFINED
  26. #  define gs_matrix_DEFINED
  27. typedef struct gs_matrix_s gs_matrix;
  28. #endif
  29.  
  30. #ifndef gs_uid_DEFINED
  31. #  define gs_uid_DEFINED
  32. typedef struct gs_uid_s gs_uid;
  33. #endif
  34.  
  35. /*
  36.  * Unless otherwise noted, all the following routines return 0 for
  37.  * a valid parameter, 1 for a defaulted parameter, or <0 on error.
  38.  *
  39.  * Note that all the dictionary parameter routines take a C string,
  40.  * not a t_name ref *.  Even though this is slower, it means that
  41.  * the GC doesn't have to worry about finding statically declared
  42.  * name refs, and we have that many fewer static variables.
  43.  *
  44.  * All these routines allow pdict == NULL, which they treat the same as
  45.  * pdict referring to an empty dictionary.  Routines with "null" in their
  46.  * name return 2 if the parameter is null, without setting *pvalue.
  47.  */
  48. int dict_bool_param(P4(const ref * pdict, const char *kstr,
  49.                bool defaultval, bool * pvalue));
  50. int dict_int_param(P6(const ref * pdict, const char *kstr,
  51.               int minval, int maxval, int defaultval, int *pvalue));
  52. int dict_int_null_param(P6(const ref * pdict, const char *kstr,
  53.                int minval, int maxval, int defaultval,
  54.                int *pvalue));
  55. int dict_uint_param(P6(const ref * pdict, const char *kstr,
  56.                uint minval, uint maxval, uint defaultval,
  57.                uint * pvalue));
  58. int dict_float_param(P4(const ref * pdict, const char *kstr,
  59.             floatp defaultval, float *pvalue));
  60. /*
  61.  * There are 3 variants of the procedures for getting array parameters.
  62.  * All return the element count if the parameter is present and of the
  63.  * correct size, 0 if the key is missing.
  64.  *    _xxx_check_param return over_error if the array size > len,
  65.  *      (under_error < 0 ? under_error : the element count) if the array
  66.  *      size < len.
  67.  *    _xxx_param return limitcheck if the array size > maxlen.
  68.  *      Equivalent to _xxx_check_param(..., 0, limitcheck).
  69.  *    _xxxs return rangecheck if the array size != len.
  70.  *      Equivalent to _xxx_check_param(..., rangecheck, rangecheck).
  71.  * All can return other error codes (e.g., typecheck).
  72.  */
  73. int dict_int_array_check_param(P6(const ref * pdict, const char *kstr,
  74.                   uint len, int *ivec,
  75.                   int under_error, int over_error));
  76. int dict_int_array_param(P4(const ref * pdict, const char *kstr,
  77.                 uint maxlen, int *ivec));
  78. int dict_ints_param(P4(const ref * pdict, const char *kstr,
  79.                uint len, int *ivec));
  80. /*
  81.  * For _float_array_param, if the parameter is missing and defaultvec is
  82.  * not NULL, copy (max)len elements from defaultvec to fvec and return
  83.  * (max)len.
  84.  */
  85. int dict_float_array_check_param(P7(const ref * pdict, const char *kstr,
  86.                     uint len, float *fvec,
  87.                     const float *defaultvec,
  88.                     int under_error, int over_error));
  89. int dict_float_array_param(P5(const ref * pdict, const char *kstr,
  90.                   uint maxlen, float *fvec,
  91.                   const float *defaultvec));
  92. int dict_floats_param(P5(const ref * pdict, const char *kstr,
  93.              uint len, float *fvec,
  94.              const float *defaultvec));
  95.  
  96. /*
  97.  * For dict_proc_param,
  98.  *      defaultval = false means substitute t__invalid;
  99.  *      defaultval = true means substitute an empty procedure.
  100.  * In either case, return 1.
  101.  */
  102. int dict_proc_param(P4(const ref * pdict, const char *kstr, ref * pproc,
  103.                bool defaultval));
  104. int dict_matrix_param(P3(const ref * pdict, const char *kstr,
  105.              gs_matrix * pmat));
  106. int dict_uid_param(P5(const ref * pdict, gs_uid * puid, int defaultval,
  107.               gs_memory_t * mem, const i_ctx_t *i_ctx_p));
  108.  
  109. /* Check that a UID in a dictionary is equal to an existing, valid UID. */
  110. bool dict_check_uid_param(P2(const ref * pdict, const gs_uid * puid));
  111.  
  112. #endif /* idparam_INCLUDED */
  113.